<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<c:if test="${not empty customers}">
	<c:if test="${not empty maxResultReached && maxResultReached eq true}">
		<div class="alert alert-block">
			<h4 class="alert-heading"><spring:message code="common.warning" /></h4>
			<spring:message code="common.warning.search" arguments="${maxResult}"/>
		</div>
	</c:if>
	<table id="customersResult" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<td><spring:message code="customers.id" /></td>
				<td><spring:message code="customers.name" /></td>
				<td><spring:message code="customers.firstname" /></td>
				<td><spring:message code="customers.agency.name" /></td>
				<td><spring:message code="common.action" /></td>
			</tr>
		</thead>
		<tbody>
		<c:forEach var="customer" items="${customers}" >
		<tr>
			<td>${customer.id}</td>
			<td>${customer.name}</td>
			<td>${customer.firstname}</td>
			<td>
				 <c:forEach var="agency" items="${customer.agencies}" >
				 	${agency.name}<br/>
	    		</c:forEach>
			</td>
			<td><a href="<spring:url value="/customers/${customer.id}"/>"><i class="icon-eye-open" title="<spring:message code="customers.action.detail" />"></i></a></td>
		</tr>
		</c:forEach>
		</tbody>
	</table>

</c:if>
<c:if test="${empty customers}">
    <div class="alert alert-info">
    	<spring:message code="customers.result.empty" />
	</div>
</c:if>